#include<stdio.h>
#include<stdlib.h>
#include"util.h"

void my_free(void* ptr)
{ 
	void* startPtr = (int*)ptr - 1;
	int i, size = *(int*)startPtr;
	char* p = (char*)startPtr;
	for(i = 0; i < size; i++, p++) {
		*p = 0xCC;
	}
#undef free
	free(startPtr);
#define free(ptr) my_free(ptr)
}


void* my_malloc(int size)
{
#undef malloc
	void* ptr = malloc((size) + sizeof(int));
#define malloc(size) my_malloc(size)
	*(int*)ptr = size;
	return (char*)ptr + sizeof(int);
}